package com.object.module.didi.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.object.module.didi.entity.DdOrderFormEntity;
import com.object.module.didi.service.DdOrderFormService;
import com.object.configuration.utils.PageUtils;
import com.object.configuration.utils.Q;


/**
 * 订单
 *
 * @author 小🌤
 * @email 1578442339@qq.com
 * @date 2021-10-30 15:57:53
 */
@RestController
@RequestMapping("/dd/orderform")
public class DdOrderFormController {
    @Autowired
    private DdOrderFormService ddOrderFormService;


    /**
     * 列表
     */
    @RequestMapping("/list")
    public Q list(@RequestParam Map<String, Object> params) {
        PageUtils page = ddOrderFormService.queryPage(params);
        return Q.ok().put("page", page);
    }




    /**
     * 信息
     */
    @RequestMapping("/info/{ofId}")
    public Q info(@PathVariable("ofId") Integer ofId) {
            DdOrderFormEntity ddOrderForm = ddOrderFormService.getById(ofId);
            return Q.ok().put("ddOrderForm", ddOrderForm);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Q save(@RequestBody DdOrderFormEntity ddOrderForm) {
            ddOrderFormService.save(ddOrderForm);
            return Q.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Q update(@RequestBody DdOrderFormEntity ddOrderForm) {
            ddOrderFormService.updateById(ddOrderForm);
            return Q.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Q delete(@RequestBody Integer[] ofIds) {
            ddOrderFormService.removeByIds(Arrays.asList(ofIds));
            return Q.ok();
    }

}
